<?php if(!defined('IN_APP')) exit('Access Denied');?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>商城</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/swiper.min.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/reset.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/common.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/style.css">	
</head>
<body>
	<!-- S header -->
	<header>
		<h1>订单</h1>
	</header>
	<!-- E header -->
	<ul class="order-head flex flex-pack-justify">
		<li class="cur" id="all">全部</li>
		<li id="center">交易中</li>
		<li id="complete">已完成</li>
	</ul>
	<!-- S 内容 -->
	<div>
		<?php foreach($order_info as $key =>$value) : ?>
				<a href="<?php echo U('order_detail?id='.$value['id'].'&status='.$value['status']); ?>" class="order-item">
					<ul class="flex flex-pack-justify head">
						<li>买入/卖出</li>
						<li>数量/总价</li>
						<li>当前情况</li>
					</ul>
					<div class="flex flex-pack-justify body">
						<div class="aside1">
							<?php if($value['user_id'] == session('id')) : ?>
								买入
							<?php elseif($value['sell_id'] == session('id')) : ?>
								卖出
							<?php endif ?>
						</div>
						<ul class="flex-1 aside2">
							<li><span class="black"><?php echo $value['number'] ?></span>/<?php echo $value['all_price'];?>GF</li>
							<!-- <li><span class="black">23.3</span>云豆</li> -->
						</ul>
						<div class="aside3">
							<?php if($value['status'] == 1) : ?>
								待匹配 <i class="iconfont">&#xe6a0;</i>
							<?php elseif($value['status'] == 2) : ?>
								待付款 <i class="iconfont">&#xe6a0;</i>
							<?php elseif($value['status'] == 3) : ?>
								待确认 <i class="iconfont">&#xe6a0;</i>
							<?php elseif($value['status'] == 4) : ?>
								已完成 <i class="iconfont">&#xe6a0;</i>
						<?php elseif($value['status'] == 0) : ?>
								待匹配 <i class="iconfont">&#xe6a0;</i>
								
							<?php endif ?>
						</div>
					</div>
					<p class="order-time">订单时间:<?php echo $value['update_time'];?></p>
				</a>
				<input type="hidden" value="<?php echo $value['status']; ?>" name="status"/>
		<?php endforeach ?>
		
		<!-- <a href="" class="order-item">
			<ul class="flex flex-pack-justify head">
				<li>买入/卖出</li>
				<li>数量/总价</li>
				<li>当前情况</li>
			</ul>
			<div class="flex flex-pack-justify body">
				<div class="aside1">卖出</div>
				<ul class="flex-1 aside2">
					<li><span class="black">10</span>宝石</li>
				
				</ul>
				<div class="aside3">
					已完成 <i class="iconfont">&#xe6a0;</i>
				</div>
			</div>
			<p class="order-time">订单时间:2018.11.20  15:45:32</p>
		</a> -->
	</div>
	<!-- E 内容 -->
	<p class="no-more">没有更多了</p>

	<!-- S footer -->
	<div class="footBox">
		<footer>
			<a href="/index.php?m=user&c=trade&a=index&type=buy">
				<i class="iconfont">&#xe69d;</i>
				<span>交易所</span>
			</a>
			<a href="/index.php?m=user&c=exchange&a=index">
				<i class="iconfont">&#xe69a;</i>
				<span>兑换</span>
			</a>
			<a href="/index.php?m=user&c=goods&a=index">
				<i class="iconfont">&#xe69e;</i>
				<span>商城</span>
			</a>
			<a href="/index.php?m=user&c=order&a=index" class="cur">
				<i class="iconfont">&#xe69b;</i>
				<span>订单</span>
			</a>
			<a href="/index.php?m=user&c=home&a=index">
				<i class="iconfont">&#xe6a3;</i>
				<span>我的</span>
			</a>
		</footer>
	</div>
	<!-- E footer -->
	
	<script src="<?php echo THEME_PATH;?>js/jquery-1.8.3.min.js"></script>
	<script src="<?php echo THEME_PATH;?>js/swiper.min.js"></script>
	<script>
	$(function(){
		var type = <?php echo $type; ?>;
		if(type == 1){
			$('#all').addClass("cur").siblings().removeClass("cur");
		}else if(type ==2){
			$('#center').addClass("cur").siblings().removeClass("cur");
		}else{
			$('#complete').addClass("cur").siblings().removeClass("cur");
		}

		
		$(".order-head li").click(function(){
			$(this).addClass("cur").siblings().removeClass("cur");
			// var status = $("input[name='status']").val();
			// console.log(status);
			// return false;

			var type = $(this).attr('id');
			if(type == 'all'){
				type = 1;
			}else if(type == 'center'){
				type = 2;
			}else{
				type = 3;
			}
			window.location.href="/index.php?m=user&c=order&a=index&type="+type;
		})
	})

	</script>
</body>
</html>